<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master" CodeBehind="ByAvailability.aspx.cs" Inherits="www.Search_ByAvailability" %>

<%@ Register Assembly="NBusiness" Namespace="NBusiness.Data.Web" TagPrefix="cc1" %>

<asp:Content ID="Content1" runat="Server" ContentPlaceHolderID="contentPlaceHolder1">
    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="AvailabilityEntitySource"
        DataTextField="Text" DataValueField="AvailabilityId" OnDataBound="DropDownList1_DataBound">
    </asp:DropDownList>
    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Go" />
    <cc1:EntityDataSource ID="AvailabilityEntitySource" runat="server" AssemblyName="Example.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
        OnSelect="AvailabilityEntitySource_Select" TypeName="BeerBase.Business.CachedAvailabilityCollection">
    </cc1:EntityDataSource>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="BeerId"
        DataSourceID="BeerEntitySource" OnRowDataBound="GridView1_RowDataBound" AllowPaging="True" AllowSorting="True">
        <Columns>
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:TemplateField HeaderText="Style" SortExpression="BeerStyleId">
                <ItemTemplate>
                    <asp:HyperLink ID="StyleLink" runat="server" NavigateUrl='<%# Eval("BeerStyleId", "~/Search/ByStyle.aspx?s={0}") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Alcohol" HeaderText="Alcohol" SortExpression="Alcohol" DataFormatString="{0:p}" />
            <asp:TemplateField HeaderText="Brewing Company" SortExpression="CompanyId">
                <ItemTemplate>
                    <asp:HyperLink ID="CompanyLink" runat="server" NavigateUrl='<%# Eval("CompanyId", "~/Company.aspx?c={0}") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <cc1:EntityDataSource ID="BeerEntitySource" runat="server" 
        AssemblyName="Example.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
        OnSelect="BeerEntitySource_Select" TypeName="BeerBase.Business.BeerCollection">
    </cc1:EntityDataSource>
</asp:Content>